import elu.dashboard.handler as dashboardHandler
import elu.project.handler as projectHandler
import elu.mail.handler as mailHandler
import elu.topic.handler as topicHandler
import elu.timeline.handler as timelineHandler
import elu.docer.handler as docerHandler
import elu.sandbox.handler as sandboxHandler
import elu.backyard.profile.handler as backyardProfileHandler
import elu.backyard.project.handler as backyardProjectHandler
import elu.backyard.mail.handler as backyardMailHandler
import elu.backyard.topic.handler as backyardTopicHandler
import elu.backyard.docer.handler as backyardDocerHandler
import elu.backyard.user.handler as backyardUserHandler
import elu.backyard.parameter.handler as backyardParameterHandler


handlers = [
    (r"/", dashboardHandler.DashboardHandler),

    (r"/project", projectHandler.ProjectHanlder),

    (r"/mail", mailHandler.MailHandler),

    (r"/topic", topicHandler.TopicHandler),

    (r"/timeline", timelineHandler.TimelineHandler),

    (r"/docer", docerHandler.DocerHandler),

    (r"/sandbox", sandboxHandler.SandboxHandler),
    (r"/sandbox/upload", sandboxHandler.SandboxUploadHandler),
    (r"/sandbox/download/(.*)", sandboxHandler.SandboxDownloadHanlder),

    (r"/backyard/profile", backyardProfileHandler.ProfileHandler),

    (r"/backyard/manage", backyardProjectHandler.ProjectHandler),
    (r"/backyard/manage/project", backyardProjectHandler.ProjectHandler),
    (r"/backyard/manage/mail", backyardMailHandler.MailHandler),
    (r"/backyard/manage/topic", backyardTopicHandler.TopicHandler),
    (r"/backyard/manage/docer", backyardDocerHandler.DocerHandler),
    (r"/backyard/manage/user", backyardUserHandler.UserHandler),
    (r"/backyard/manage/parameter", backyardParameterHandler.ParameterHandler),

    # API for backbone
    (r"/api/project", projectHandler.ProjectAPIHandler),

    (r"/api/mail", mailHandler.MailAPIHandler),

    (r"/api/topic", topicHandler.TopicAPIHandler),
    (r"/api/topic/application", topicHandler.TopicApplicationAPIHandler),

    (r"/api/backyard/manage/docer/book", backyardDocerHandler.DocerAPIHandler),

    (r"/api/backyard/manage/parameter/personnel", backyardParameterHandler.ParameterPersonnelAPIHandler),
    (r"/api/backyard/manage/parameter/position",
        backyardParameterHandler.ParameterAPIHandler, {"tablename": "supp_position"}),
    (r"/api/backyard/manage/parameter/application",
        backyardParameterHandler.ParameterAPIHandler, {"tablename": "supp_application"}),
    (r"/api/backyard/manage/parameter/channel",
        backyardParameterHandler.ParameterAPIHandler, {"tablename": "supp_channel"}),
    (r"/api/backyard/manage/parameter/group",
        backyardParameterHandler.ParameterAPIHandler, {"tablename": "auth_group"}),
]
